"""
发送post请求
"""
import requests

#有道词典翻译url,url去掉_o
url='http://fanyi.youdao.com/?keyfrom=dict2.top'
#带User-Agent的请求头
h={
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}
#请求体数据
d={
'i': '好好学习',
'from': 'AUTO',
'to': 'AUTO',
'smartresult': 'dict',
'client': 'fanyideskweb',
'salt': '16057688207108',
'sign': '65596d3130f68a92c87c022de2fae9d0',
'lts': '1605768820710',
'bv': 'f7d97c24a497388db1420108e6c3537b',
'doctype': 'json',
'version': '2.1',
'keyfrom': 'fanyi.web',
'action': 'FY_BY_CLICKBUTTION'
}
#发送post请求(需要请求体)
response=requests.post(url,headers=h,data=d)
#打印响应内容
print(response.content.decode())